package model.persistence.daos;

import java.util.Collection;

import model.entities.Ingrediente;
import model.persistence.HibernateSessionFactory;

import org.hibernate.Criteria;
import org.hibernate.Session;

public class IngredienteDAO extends GenericDAO{
	
	public static Ingrediente getById(int id)
	{
		Session session = HibernateSessionFactory.getSessionFactory().openSession();
		return (Ingrediente)session.load(Ingrediente.class, id);
	}
	
	@SuppressWarnings("unchecked")
	public static Collection<Ingrediente> getAll()
	{
		Session session = HibernateSessionFactory.getSessionFactory().openSession();

		Criteria c = session.createCriteria(Ingrediente.class);
		return c.list();
	}

}
